<!--
 * @Description: 加载显示页面
 * @Author: Kerwin
 * @Date: 2025-10-14 10:40:23
 * @LastEditTime: 2025-10-14 11:12:07
 * @LastEditors:  Please set LastEditors
-->
<template>
  <view v-if="modelValue" class="overlay">
    <view class="loading-content">
      <u-loading mode="circle" :size="size" :color="color"></u-loading>
      <text class="loading-text">{{ text }}</text>
    </view>
  </view>
</template>

<script setup lang="ts">
// 定义组件的 props
const props = defineProps({
  modelValue: {
    type: Boolean,
    default: false
  },
  text: {
    type: String,
    default: '正在加载中...'
  },
  size: {
    type: [String, Number],
    default: 60
  },
  color: {
    type: String,
    default: '#ff6c18'
  }
})
</script>

<style scoped>
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 40rpx;
  border-radius: 20rpx;
}

.loading-text {
  margin-top: 20rpx;
  font-size: 30rpx;
  color: #fff;
}
</style>
